package com.etone.smartAudit.utils.gis;

import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * Created by Lanny on 2016-5-10.
 */
@Builder
@Data
@NoArgsConstructor
public class Gps {


    private double wgLat;
    private double wgLon;

    public Gps(double wgLat, double wgLon) {
        setWgLat(wgLat);
        setWgLon(wgLon);
    }

    public Gps(String s1, String s2) {

        double x = Double.parseDouble(s1);
        double y = Double.parseDouble(s2);

        // 大的是Lon，小的是Lat
        if (x > y) {
            setWgLat(y);
            setWgLon(x);
        } else {
            setWgLat(x);
            setWgLon(y);
        }
    }


    public double getWgLat() {
        return wgLat;
    }

    public void setWgLat(double wgLat) {
        this.wgLat = wgLat;
    }

    public double getWgLon() {
        return wgLon;
    }

    public void setWgLon(double wgLon) {
        this.wgLon = wgLon;
    }

    @Override
    public String toString() {
        return wgLat + "," + wgLon;
    }
}
